@extends('desktop.template.bootstrap')
@section('title', '小说搜索 - 007书房')
@section('keywords', '小说搜索,007书房')

@section('scripts')
<link rel="stylesheet" href="{{asset('css/public-search.css')}}" />
@endsection

@section('header')
@include('desktop.template.navbar-simple')
@endsection

@section('content')
<section class="banner">
	<div class="container">
		<ol class="breadcrumb">
			<li><a href="{{ url('/') }}">首页</a></li>
			<li class="active">搜索</li>
		</ol>
	</div>
</section>

<section class="search">
	<div class="container">
		<div class="search-box">
		{!! Form::open(array('method' => 'GET', 'url' => 'search', 'class' => 'form-group')) !!}
			<div class="input-group">
				<input class="form-control input-lg" name="keywords" type="text" value="{{ $keywords }}" />
				<a href="javascript::void(0)" class="input-group-addon btn-danger" onclick="$(this).parent().parent().submit()">
					搜索
				</a>
			</div>
		{!! Form::close() !!}
		</div>
		<div class="row">
			<div class="col-xs-9">
				<div class="order">
					<ul class="list-unstyled list-inline">
						<li @if($sort == 'likes') class="active" @endif><a href="{{ url('/search?keywords='.$keywords.'&sort=likes') }}">人气排序</a></li>
						<li @if($sort == 'font_num') class="active" @endif><a href="{{ url('/search?keywords='.$keywords.'&sort=font_num') }}">总字数</a></li>
						<li @if($sort == 'clicks') class="active" @endif><a href="{{ url('/search?keywords='.$keywords.'&sort=clicks') }}">点击量</a></li>
					</ul>
				</div>
				<div class="books">
					@foreach($books as $book)
					<div class="book">
						<div class="media">
							<div class="media-left">
								<a href="{{ url('books/'.$book->id) }}"><img height="100%" src="{{ $book->thumbnailUrl() }}" alt="" /></a>
							</div>
							<div class="media-body">
								<h3 class="title"><a href="{{ url('books/'.$book->id) }}">{{ $book->name }}</a></h3>
								<div class="author">
									<span class="fa fa-fw fa-user-circle-o"></span>
									{{ $book->author }} &nbsp;|&nbsp;
									@if(is_null($book->category_id))
									{{ $book->old_category }} &nbsp;|&nbsp;
									@else
									{{ $book->category->name }} &nbsp;|&nbsp;
									@endif
								</div>
								<div class="desc">
									{!! $book->abstract !!}
								</div>
								<div class="row">
									<div class="col-xs-8">
										<div class="info">
											最新章节
											<a href="{{ url('sections/'.$book->getLastSection()->id) }}">{{ $book->getLastSection()->name }}</a>
										</div>
									</div>
									<div class="col-xs-4 text-right">
										<a href="{{ url('books/'.$book->id) }}" class="btn btn-danger">书籍详情</a>
									</div>
								</div>
							</div>
						</div>
					</div>
					@endforeach
				</div>
			</div>
			<div class="col-xs-3">
				<div class="recommend">
					<h4 class="title">
						热门推荐
					</h4>
					<ul class="list-unstyled books-sm">
						@foreach($hotBooks as $hotBook)
						<li>
							<a class="book-sm" href="{{ url('/books/'.$hotBook->order) }}">
								<div class="media">
									<div class="media-left">
										<img height="100%" src="{{ $hotBook->thumbnailUrl() }}" alt="" />
									</div>
									<div class="media-body">
										<h4 class="title dotdotdot-nowrap">{{ $hotBook->name }}</h4>
										<div class="author">
											<span class="fa fa-fw fa-user-circle-o"></span>
											{{ $hotBook->author }}
										</div>
										<div class="abstract">
											{!! str_limit(str_replace("&nbsp;","",strip_tags($hotBook->abstract)), 70) !!}
										</div>
										<div class="info"><span class="label label-default">{{ floor($hotBook->clicks/10000) }}万人点击</span></div>
									</div>
								</div>
							</a>
						</li>
						@endforeach
					</ul>
				</div>
			</div>
		</div>
	</div>
</section>

@endsection